package by.semerikov.statictic;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import by.semerikov.parts.Log;

public class StaticticByType {

	private List<Log> list = new ArrayList<>();

	public StaticticByType(List<Log> list) {
		this.setList(list);
	}

	public Map<String, Integer> getStaticticByType() {
		Map<String, Integer> result = new HashMap<String, Integer>();
		
			for (int j = 0; j < list.size(); j++) {
				String type = list.get(j).getRequestLine().getPath().split("\\.")[1];
				Integer count = result.get(type);
				if ( count == null )
				{
					count = 0;
				}
				count++;
				result.put(type , count);
			}
			
		
		return result;
	}

	public List<Log> getList() {
		return list;
	}

	public void setList(List<Log> list) {
		this.list = list;
	}

}
